/********************************************************************************
 * @Author: Zhenzhou Liu
 * @Date: 2025-02-08
 * @Description: 
 *******************************************************************************/
#include <stdio.h>
#include <stdlib.h>

#define MAX_SIZE 10000

typedef struct {
  int data[MAX_SIZE];
  int top;
 } Stack;

 void initStack(Stack *s) {
   s->top = -1;
 }

 int isEmpty(Stack *s) {
   return s->top == -1;
 }

 int isFull(Stack *s) {
   return s->top == MAX_SIZE - 1;
 }

 void push(Stack *s, int value) {
   if (isFull(s)) {
     printf("Stack is full\n");
     return;
   }
   s->data[++s->top] = value;
 }

 int pop(Stack *s) {
   if (isEmpty(s)) {
     printf("Stack is empty\n");
     return -1;
   }
   return s->data[s->top--];
 }

 int peek(Stack *s) {
   if (isEmpty(s)) {
     printf("Stack is empty\n");
     return -1;
   }
   return s->data[s->top];
 }

 void sortStack(Stack *s) {
   Stack help;
   initStack(&help);
   while (!isEmpty(s)) {
     int cur = pop(s);
     while (!isEmpty(&help) && peek(&help) < cur) {
       push(s, pop(&help));
     }
     push(&help, cur);
   }

   while (!isEmpty(&help)) {
     push(s, pop(&help));
   }
 }

 int main() {
   int n;
   scanf("%d", &n);
   Stack s;
   initStack(&s);

   for (int i = 0; i < n; i++) {
     int value;
     scanf("%d", &value);
     push(&s, value);
   }

   sortStack(&s);

   for (int i = 0; i < n; i++) {
     if (i > 0)
       printf(" ");
     printf("%d", pop(&s));
   }
   return 0;
 }